cmake_minimum_required(VERSION 3.18)
project(rust_cuda_kernels LANGUAGES CXX CUDA)

# 设置CUDA架构 - 根据您的GPU调整
set(CUDA_ARCHITECTURES "75;80;86;89;90")

# 创建共享库
add_library(rust_cuda_kernels SHARED kernel.cu)

# 配置NVCC编译选项
set_target_properties(rust_cuda_kernels PROPERTIES
    CUDA_SEPARABLE_COMPILATION ON
    POSITION_INDEPENDENT_CODE ON
    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
)

# 安装库文件
install(TARGETS rust_cuda_kernels 
    LIBRARY DESTINATION lib
    RUNTIME DESTINATION bin
)